package com.javafour;

public class ArrasUtile {
    public static String[] strArray(String str){
        System.out.println(str);
        int index=1;
        String[] strings = new String[1];
        boolean isflag=true;
        int count=0;
        while (isflag){
            int i = str.indexOf(" ");
            if(i>0){
                strings[count]=str.substring(0,i);
                index++;
                //创建新数组
                strings = coPyNewArray(strings, index);
                str = str.substring(i+1,str.length());
                count++;
            }else {
                strings[count]=str;
                isflag=false;
            }
        }
        return strings;
    }

    public static  String[] coPyNewArray(String[] oldArray,int index){

        return new String[index];
    }
}
